﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using EDTS.Model.Weixin;
namespace EDTS.Data.Weixin
{
    public class WxProcessorCommand
    {
        public static WxProcessorModel GetModel(string msgType, string code)
        {
            if (!string.IsNullOrEmpty(msgType) && !string.IsNullOrEmpty(code))
            {
                using (DBCentre db = new DBCentre())
                {
                    var d = db.DataContext.WxProcessors.FirstOrDefault(p => p.MsgType == msgType && p.Code == code);
                    if (d != null)
                    {
                        var ret = Convertor.ConvertTo<WxProcessorModel, WxProcessor>(d);
                        return ret;
                    }
                }
            }
            return null;
        }
    }
}
